package tankgame03;

public class Hero extends Tank {
    //自己的坦克
    public Hero(int x, int y) {
        super(x, y);
    }
    //定义一个shot对象
    Shot shot=null;
    //射击方法
    public void shotEnemy(){
        //创建Shot对象
        switch (getDirection()){//hero的方向
            case 0:
                shot=new Shot(getX()+20,getY(),0);
                break;
            case 1:
                shot=new Shot(getX()+60,getY()+20,1);
                break;
            case 2:
                shot=new Shot(getX()+20,getY()+60,2);
                break;
            case 3:
                shot=new Shot(getX(),getY()+20,3);
                break;
        }
        //启动Shot线程
        new Thread(shot).start();
    }
}
